from Parameters import *
from PolymorphismTables import PolymorphismTables
import SiteFrequencySpectrum as sfs
from PolyspectOperator import *

import scipy.stats.mstats as mstats
import infiniteSitesTools as ist
import matplotlib.pyplot as plt
import numpy.matlib as np
from math import sqrt

#test
NUM_OF_SIMULATIONS = 10
NUM_OF_CHROMOSOMES = 5

N = 1e4
MU = 1e-8
LENGTH = 25000
THETA = 4.0 * N * MU * LENGTH

p = Population(NUM_OF_CHROMOSOMES, N, LENGTH, MU, 0.0)
d = Demography(N)

simParams = SimulationParameters( p, d )
print simParams

myTD = ist.getOp_FayWuH( NUM_OF_CHROMOSOMES )
polyOp = Polyspect(myTD, simParams, NUM_OF_SIMULATIONS )
ssList = polyOp.operateOnAll( polyOp.mySFSs )

myList = [-3, -2, -1, 0, 1, 2, 3]

tList = polyOp.testAltHypotheses(myList)
print tList
print np.sum(tList)

polyOp.getRejectionValues(0.05)
plt.hist(ssList, 20)
plt.show()